﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
using System.IO;

class IsoStorageDateTime
{
    static void Main()
    {
        string date = DateTime.Now.ToString();
        IsolatedStorageFile userStorage = IsolatedStorageFile.GetUserStoreForAssembly();
        using (userStorage)
        {
            IsolatedStorageFileStream isolatedStream =
                    new IsolatedStorageFileStream("DateTime.txt", FileMode.OpenOrCreate, userStorage);
            using (isolatedStream)
            {
                using (TextReader reader = new StreamReader(isolatedStream))
                {
                    Console.WriteLine(reader.ReadLine());
                }                
            }
        }
        userStorage = IsolatedStorageFile.GetUserStoreForAssembly();
        using (userStorage)
        {
            IsolatedStorageFileStream isolatedStream =
                new IsolatedStorageFileStream("DateTime.txt", FileMode.Open, userStorage);
            using (isolatedStream)
            {
                using (TextWriter write = new StreamWriter(isolatedStream))
                {
                    write.WriteLine(date);
                }
            }
        }
    }
}
